Optimal. Leaf size=55 \[ \frac {b \cot (x)}{a^2}-\frac {\csc ^2(x)}{2 a}+\frac {\left (a^2+b^2\right ) \log (\sin (x))}{a^3}-\frac {\left (a^2+b^2\right ) \log (a \cos (x)+b \sin (x))}{a^3} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.09, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.375, Rules used = {3182, 3852, 8,
3180, 3556, 3212} \begin {gather*} \frac {b \cot (x)}{a^2}+\frac {\left (a^2+b^2\right ) \log (\sin (x))}{a^3}-\frac {\left (a^2+b^2\right ) \log (a \cos (x)+b \sin (x))}{a^3}-\frac {\csc ^2(x)}{2 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3180
Rule 3182
Rule 3212
Rule 3556
Rule 3852
Rubi steps
\begin {align*} \int \frac {\csc ^3(x)}{a \cos (x)+b \sin (x)} \, dx &=-\frac {\csc ^2(x)}{2 a}-\frac {b \int \csc ^2(x) \, dx}{a^2}+\frac {\left (a^2+b^2\right ) \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx}{a^2}\\ &=-\frac {\csc ^2(x)}{2 a}+\frac {b \text {Subst}(\int 1 \, dx,x,\cot (x))}{a^2}+\frac {\left (a^2+b^2\right ) \int \cot (x) \, dx}{a^3}-\frac {\left (a^2+b^2\right ) \int \frac {b \cos (x)-a \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{a^3}\\ &=\frac {b \cot (x)}{a^2}-\frac {\csc ^2(x)}{2 a}+\frac {\left (a^2+b^2\right ) \log (\sin (x))}{a^3}-\frac {\left (a^2+b^2\right ) \log (a \cos (x)+b \sin (x))}{a^3}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.17, size = 48, normalized size = 0.87 \begin {gather*} \frac {2 a b \cot (x)-a^2 \csc ^2(x)+2 \left (a^2+b^2\right ) (\log (\sin (x))-\log (a \cos (x)+b \sin (x)))}{2 a^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 53, normalized size = 0.96
method | result | size |
default | \(-\frac {1}{2 a \tan \left (x \right )^{2}}+\frac {\left (a^{2}+b^{2}\right ) \ln \left (\tan \left (x \right )\right )}{a^{3}}+\frac {b}{a^{2} \tan \left (x \right )}-\frac {\left (a^{2}+b^{2}\right ) \ln \left (a +b \tan \left (x \right )\right )}{a^{3}}\) | \(53\) |
norman | \(\frac {-\frac {1}{8 a}-\frac {\tan ^{4}\left (\frac {x}{2}\right )}{8 a}+\frac {b \tan \left (\frac {x}{2}\right )}{2 a^{2}}-\frac {b \left (\tan ^{3}\left (\frac {x}{2}\right )\right )}{2 a^{2}}}{\tan \left (\frac {x}{2}\right )^{2}}+\frac {\left (a^{2}+b^{2}\right ) \ln \left (\tan \left (\frac {x}{2}\right )\right )}{a^{3}}-\frac {\left (a^{2}+b^{2}\right ) \ln \left (a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-2 b \tan \left (\frac {x}{2}\right )-a \right )}{a^{3}}\) | \(96\) |
risch | \(\frac {2 i \left (-i a \,{\mathrm e}^{2 i x}+b \,{\mathrm e}^{2 i x}-b \right )}{\left ({\mathrm e}^{2 i x}-1\right )^{2} a^{2}}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {i b +a}{i b -a}\right )}{a}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {i b +a}{i b -a}\right ) b^{2}}{a^{3}}+\frac {\ln \left ({\mathrm e}^{2 i x}-1\right )}{a}+\frac {\ln \left ({\mathrm e}^{2 i x}-1\right ) b^{2}}{a^{3}}\) | \(127\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 119 vs.
\(2 (53) = 106\).
time = 0.28, size = 119, normalized size = 2.16 \begin {gather*} -\frac {\frac {4 \, b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {a \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}}{8 \, a^{2}} - \frac {{\left (a^{2} + b^{2}\right )} \log \left (-a - \frac {2 \, b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {a \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}\right )}{a^{3}} + \frac {{\left (a^{2} + b^{2}\right )} \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{a^{3}} - \frac {{\left (a - \frac {4 \, b \sin \left (x\right )}{\cos \left (x\right ) + 1}\right )} {\left (\cos \left (x\right ) + 1\right )}^{2}}{8 \, a^{2} \sin \left (x\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 117 vs.
\(2 (53) = 106\).
time = 1.66, size = 117, normalized size = 2.13 \begin {gather*} -\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) - a^{2} + {\left ({\left (a^{2} + b^{2}\right )} \cos \left (x\right )^{2} - a^{2} - b^{2}\right )} \log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right ) - {\left ({\left (a^{2} + b^{2}\right )} \cos \left (x\right )^{2} - a^{2} - b^{2}\right )} \log \left (-\frac {1}{4} \, \cos \left (x\right )^{2} + \frac {1}{4}\right )}{2 \, {\left (a^{3} \cos \left (x\right )^{2} - a^{3}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\csc ^{3}{\left (x \right )}}{a \cos {\left (x \right )} + b \sin {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 78, normalized size = 1.42 \begin {gather*} \frac {{\left (a^{2} + b^{2}\right )} \log \left ({\left | \tan \left (x\right ) \right |}\right )}{a^{3}} - \frac {{\left (a^{2} b + b^{3}\right )} \log \left ({\left | b \tan \left (x\right ) + a \right |}\right )}{a^{3} b} - \frac {3 \, a^{2} \tan \left (x\right )^{2} + 3 \, b^{2} \tan \left (x\right )^{2} - 2 \, a b \tan \left (x\right ) + a^{2}}{2 \, a^{3} \tan \left (x\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.57, size = 91, normalized size = 1.65 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )\,\left (a^2+b^2\right )}{a^3}-\frac {\ln \left (-a\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )+a\right )\,\left (a^2+b^2\right )}{a^3}-\frac {{\mathrm {tan}\left (\frac {x}{2}\right )}^2}{8\,a}-\frac {b\,\mathrm {tan}\left (\frac {x}{2}\right )}{2\,a^2}-\frac {\frac {a}{2}-2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )}{4\,a^2\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________